package o;

import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLSocket;

public final class fud {
    private static final fub[] ʼ = new fub[]{fub.ॱˈ, fub.ॱʾ, fub.ߺ, fub.ॱˍ, fub.ॱـ, fub.ˌॱ, fub.ˎͺ, fub.ͺˎ, fub.ͺˏ, fub.ߵ, fub.ߴ, fub.ʻˊ, fub.ʽˊ, fub.ͺॱ, fub.ˑ, fub.ͺ, fub.ˏॱ, fub.ˋ};
    public static final fud ˊ = new e(true).ˊ(ʼ).ॱ(fuz.TLS_1_0).ॱ(true).ॱ();
    public static final fud ˋ = new e(true).ˊ(ॱॱ).ॱ(fuz.TLS_1_3, fuz.TLS_1_2).ॱ(true).ॱ();
    public static final fud ˎ = new e(false).ॱ();
    public static final fud ˏ = new e(true).ˊ(ʼ).ॱ(fuz.TLS_1_3, fuz.TLS_1_2, fuz.TLS_1_1, fuz.TLS_1_0).ॱ(true).ॱ();
    private static final fub[] ॱॱ = new fub[]{fub.ॱˈ, fub.ॱʾ, fub.ߺ, fub.ॱˍ, fub.ॱـ, fub.ˌॱ, fub.ˎͺ, fub.ͺˎ, fub.ͺˏ, fub.ߵ, fub.ߴ};
    @Nullable
    final String[] ʻ;
    @Nullable
    final String[] ʽ;
    final boolean ॱ;
    final boolean ᐝ;

    public static final class e {
        boolean ˊ;
        boolean ˋ;
        @Nullable
        String[] ˎ;
        @Nullable
        String[] ॱ;

        e(boolean z) {
            this.ˊ = z;
        }

        public e(fud o_fud) {
            this.ˊ = o_fud.ॱ;
            this.ˎ = o_fud.ʻ;
            this.ॱ = o_fud.ʽ;
            this.ˋ = o_fud.ᐝ;
        }

        public e ˊ(fub... o_fubArr) {
            if (this.ˊ) {
                String[] strArr = new String[o_fubArr.length];
                for (int i = 0; i < o_fubArr.length; i++) {
                    strArr[i] = o_fubArr[i].ॱˑ;
                }
                return ˏ(strArr);
            }
            throw new IllegalStateException("no cipher suites for cleartext connections");
        }

        public e ˏ(String... strArr) {
            if (!this.ˊ) {
                throw new IllegalStateException("no cipher suites for cleartext connections");
            } else if (strArr.length == 0) {
                throw new IllegalArgumentException("At least one cipher suite is required");
            } else {
                this.ˎ = (String[]) strArr.clone();
                return this;
            }
        }

        public e ॱ(fuz... o_fuzArr) {
            if (this.ˊ) {
                String[] strArr = new String[o_fuzArr.length];
                for (int i = 0; i < o_fuzArr.length; i++) {
                    strArr[i] = o_fuzArr[i].ʻ;
                }
                return ˊ(strArr);
            }
            throw new IllegalStateException("no TLS versions for cleartext connections");
        }

        public e ˊ(String... strArr) {
            if (!this.ˊ) {
                throw new IllegalStateException("no TLS versions for cleartext connections");
            } else if (strArr.length == 0) {
                throw new IllegalArgumentException("At least one TLS version is required");
            } else {
                this.ॱ = (String[]) strArr.clone();
                return this;
            }
        }

        public e ॱ(boolean z) {
            if (this.ˊ) {
                this.ˋ = z;
                return this;
            }
            throw new IllegalStateException("no TLS extensions for cleartext connections");
        }

        public fud ॱ() {
            return new fud(this);
        }
    }

    fud(e eVar) {
        this.ॱ = eVar.ˊ;
        this.ʻ = eVar.ˎ;
        this.ʽ = eVar.ॱ;
        this.ᐝ = eVar.ˋ;
    }

    public boolean ˎ() {
        return this.ॱ;
    }

    @Nullable
    public List<fub> ˏ() {
        return this.ʻ != null ? fub.ˊ(this.ʻ) : null;
    }

    @Nullable
    public List<fuz> ˋ() {
        return this.ʽ != null ? fuz.ˎ(this.ʽ) : null;
    }

    public boolean ॱ() {
        return this.ᐝ;
    }

    void ˏ(SSLSocket sSLSocket, boolean z) {
        fud ˊ = ˊ(sSLSocket, z);
        if (ˊ.ʽ != null) {
            sSLSocket.setEnabledProtocols(ˊ.ʽ);
        }
        if (ˊ.ʻ != null) {
            sSLSocket.setEnabledCipherSuites(ˊ.ʻ);
        }
    }

    private fud ˊ(SSLSocket sSLSocket, boolean z) {
        String[] ˊ;
        String[] ˊ2;
        if (this.ʻ != null) {
            ˊ = fvg.ˊ(fub.ॱ, sSLSocket.getEnabledCipherSuites(), this.ʻ);
        } else {
            ˊ = sSLSocket.getEnabledCipherSuites();
        }
        if (this.ʽ != null) {
            ˊ2 = fvg.ˊ(fvg.ʻ, sSLSocket.getEnabledProtocols(), this.ʽ);
        } else {
            ˊ2 = sSLSocket.getEnabledProtocols();
        }
        String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites();
        int ˏ = fvg.ˏ(fub.ॱ, supportedCipherSuites, "TLS_FALLBACK_SCSV");
        if (z && ˏ != -1) {
            ˊ = fvg.ॱ(ˊ, supportedCipherSuites[ˏ]);
        }
        return new e(this).ˏ(ˊ).ˊ(ˊ2).ॱ();
    }

    public boolean ˊ(SSLSocket sSLSocket) {
        if (!this.ॱ) {
            return false;
        }
        if (this.ʽ != null && !fvg.ˎ(fvg.ʻ, this.ʽ, sSLSocket.getEnabledProtocols())) {
            return false;
        }
        if (this.ʻ == null || fvg.ˎ(fub.ॱ, this.ʻ, sSLSocket.getEnabledCipherSuites())) {
            return true;
        }
        return false;
    }

    public boolean equals(@Nullable Object obj) {
        if (!(obj instanceof fud)) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        fud o_fud = (fud) obj;
        if (this.ॱ != o_fud.ॱ) {
            return false;
        }
        if (!this.ॱ || (Arrays.equals(this.ʻ, o_fud.ʻ) && Arrays.equals(this.ʽ, o_fud.ʽ) && this.ᐝ == o_fud.ᐝ)) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        if (!this.ॱ) {
            return 17;
        }
        return (this.ᐝ ? 0 : 1) + ((((Arrays.hashCode(this.ʻ) + 527) * 31) + Arrays.hashCode(this.ʽ)) * 31);
    }

    public String toString() {
        if (!this.ॱ) {
            return "ConnectionSpec()";
        }
        return "ConnectionSpec(cipherSuites=" + (this.ʻ != null ? ˏ().toString() : "[all enabled]") + ", tlsVersions=" + (this.ʽ != null ? ˋ().toString() : "[all enabled]") + ", supportsTlsExtensions=" + this.ᐝ + ")";
    }
}
